home *** CD-ROM | disk | FTP | other *** search
/ Aminet 39 / Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso / Aminet / dev / basic / PureBasic.lha / PureBasic_1.50_Demo / PureBasic / Examples / Sources / WaponezII.pb < prev    next >
Encoding:
Text File  |  2000-07-19  |  15.2 KB  |  735 lines

  1. ;
  2. ; **************
  3. ;               *
  4. ; Waponez II     **********************************************
  5. ;                                                              *
  6. ;   Origninal Waponez is from NC Gamez ! Check it on Aminet...  *
  7. ;                                                                *
  8. ; *****************************************************************
  9. ;
  10. ;
  11. ; Author note (AlphaSND):
  12. ; -----------------------
  13. ;
  14. ; This game was developped in a hurry (all the game was done in 6 days,
  15. ; working at spare time) so it's just a little example of what the
  16. ; PureBasic can do. This game requiers an AGA Amiga for the nice title
  17. ; screen, else the rest of the gfx are in standard 32 colours (work
  18. ; on all Amiga). 
  19. ;
  20. ; -----------------------------------------------------------------------
  21. ;
  22. ; History:
  23. ;
  24. ; 11/03/2000
  25. ;   + Added sound support !
  26. ;   + Draw a nice title picture...
  27. ;   + Use an AmigaSprite to hide the mouse pointer.
  28. ;   + Commented the code a lot
  29. ;
  30. ; 21/02/2000
  31. ;   + Added Pause & ESC key support :).
  32. ;
  33. ; 20/02/2000
  34. ;   + Added Mapped background... A special tool has been created
  35. ;     to create nice background with ease.
  36. ;   + Start/Stop the sprite server in the loop ensure a good multitask !
  37. ;     Very plaisant to see...
  38. ;   + Added some other aliens (the final boss ;*)
  39. ;   + Added a nice FadeOut routine at the end (easy, it's PB which do it).
  40. ;   + Added collisions between player & sprite.
  41. ;
  42. ; 19/02/2000
  43. ;   + Added real sprite support (still using linked list :*)...)
  44. ;   + Added animated sprite support
  45. ;   + Added lot of bullets... It works very well !! :)
  46. ;   + Added explosion & collision routines.. Need a good CPU now :*D.
  47. ;   + Perfectly smooth on a 1230/50.
  48. ;
  49. ; 18/02/2000
  50. ;   + Added the real gfx, it looks very nice :)
  51. ;   + Implemented the bullets via a linked list, the easier way...
  52. ;
  53. ; 15/02/2000
  54. ;   + Started the routine.
  55. ;   + Very nice looking 50 fps scroll in OS mode.
  56. ;   + Added the main sprite which moving around with joypad...
  57. ;   + Added the aliens :*). 
  58. ;   + Reworked the routine because a big bug (still same speed)
  59. ;
  60.  
  61. ; This game can be started from the Workbench.
  62. ;
  63. WbStartup()
  64.  
  65. ; Initialise all the libraries we're using in this game
  66. ;
  67. InitAmigaSprites(10)
  68. InitSprite(100,100,100)
  69. InitBitMap(2)
  70. InitScreen(2)
  71. InitJoypad()
  72. InitPalette(10)
  73. InitPicture(1)
  74. InitSound(10)
  75. *TagList = InitTagList(100)
  76.  
  77. ;
  78. ; Create and allocate all the necessary bitmaps:
  79. ; 2 for the double buffering routine;
  80. ; 1 for the title screen
  81. ;
  82. AllocateBitMap(0, 320, 480+64+20, 5)  ; 2 x ScreenHeight + 64 + 20 
  83. AllocateBitMap(1, 320, 480+64+20, 5)  ;
  84. AllocateBitMap(2, 320, 50, 8)         ; Title BitMap
  85.  
  86. ;
  87. ; Our own structures for each objects (bullets, aliens,...)
  88. ; It's very handy to use such structures because all the 
  89. ; informations relative to each objects (bullet, aliens,...)
  90. ; like the position, the speed... is stored in the
  91. ; same name. It's object oriented programming :*) (A bit... OOPs)
  92. ;
  93. Structure Bullet
  94.   x.w
  95.   y.w
  96.   Width.w
  97.   Height.w
  98.   Image.w
  99.   SpeedX.w
  100.   SpeedY.w
  101. EndStructure
  102.  
  103. NewList Bullet.Bullet()
  104.  
  105.  
  106. Structure Alien
  107.   x.w
  108.   y.w
  109.   Width.w
  110.   Height.w
  111.   Speed.w
  112.   StartImage.w
  113.   EndImage.w
  114.   ImageDelay.w
  115.   NextImageDelay.w
  116.   ActualImage.w
  117.   Armor.w
  118. EndStructure
  119.  
  120. NewList Aliens.Alien()
  121.  
  122.  
  123. Structure Explosion
  124.   x.w
  125.   y.w
  126.   State.w
  127.   Delay.w
  128. EndStructure
  129.  
  130. NewList Explosion.Explosion()
  131.  
  132.  
  133. ;
  134. ; Now we create the buffers to store the erased background
  135. ; information when we will display the sprites..
  136. ;
  137. UseBitMap(1)
  138. CreateSpriteBuffer(1, 10000, BitMapID())
  139. UseBitMap(0)
  140. CreateSpriteBuffer(0, 10000, BitMapID())
  141.  
  142. ; Our global 'Path$'. All files are relative to this path for easier localisation...
  143. ;
  144. Path$ = "PureBasic:Examples/WaponezII/"
  145.  
  146. LoadSprite(0, Path$+"Back_1")
  147. LoadSprite(1, Path$+"Player_1")
  148. LoadSprite(2, Path$+"Player_2")
  149. LoadSprite(3, Path$+"Player_3")
  150. LoadSprite(4, Path$+"Bullet_1")
  151. LoadSprite(5, Path$+"Back_2")
  152.  
  153. LoadSprite(6, Path$+"Bullet_Right")
  154. LoadSprite(7, Path$+"Bullet_Left")
  155. LoadSprite(8, Path$+"Bullet_Diag1")
  156. LoadSprite(9, Path$+"Bullet_Diag2")
  157.  
  158. LoadSprite(55, Path$+"Bullet_Bottom")
  159.  
  160. ;
  161. ; Sprite 10 to 5 reserved for the rotating animated alien..
  162. ;
  163.  
  164. For k=0 To 5
  165.   LoadSprite(k+10, Path$+"Ennemy_3_"+Str(k+1))
  166. Next
  167.  
  168. ;
  169. ; Sprite 20 to 30 reserved for the explosions...
  170. ;
  171.  
  172. For k=0 To 7
  173.   LoadSprite(k+20, Path$+"Explosion_"+Str(k+1))
  174. Next
  175.  
  176. ;
  177. ; Load all the background blocks...
  178. ;
  179.  
  180. For k=0 to 9
  181.   LoadSprite(k+30, Path$+"Back_"+Str(k+1))
  182. Next
  183.  
  184. LoadSprite(50, Path$+"Boss")
  185.  
  186. ;
  187. ; Load our blank AmigaSprite to hide pointer on the 2 screens
  188. ;
  189.  
  190. LoadAmigaSprite(0, Path$+"Blank")
  191.  
  192. ;
  193. ; Now, load our sounds..
  194. ;
  195.  
  196. SoundPath$ = Path$+"Sounds/"
  197.  
  198. LoadSound(0, SoundPath$+"Lazer")
  199. SetSoundChannels(0, 1)            ; Will be played only the 1st channel
  200. SetSoundVolume(0, 32)
  201.  
  202. LoadSound(1, SoundPath$+"Background")
  203. SetSoundChannels(1, 2)            ; ...only on the 2nd channel
  204.  
  205. LoadSound(2, SoundPath$+"Explosion")
  206. SetSoundChannels(2, 4)            ; ...only the 3nd channel
  207. SetSoundVolume(2, 48)
  208. SetSoundPeriod(2, 400)
  209.  
  210. ;
  211. ; Init all variables with will be used later
  212. ;
  213.  
  214. PlayerWidth  = SpriteWidth(1)
  215. PlayerHeight = SpriteHeight(1)
  216.  
  217. ;
  218. ; Load the needed palette and the title picture (and its palette)
  219. ;
  220. LoadPalette(0, Path$+"Back_1")
  221.  
  222. LoadPicture(0, Path$+"Title_256.iff")  ; Whow a 256 colour picture ?
  223. GetPicturePalette(4, PictureID())      ;
  224.  
  225. UseBitMap(2)                      ; Render the picture on the BitMap
  226. PictureToBitMap(0, BitMapID())    ;
  227.  
  228. ; Very important: change the program priority to 20, as we need lot
  229. ; of cpu time..
  230. ProgramPriority(20) 
  231.  
  232. ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP)
  233.       AddTag(#SA_Quiet, 1)
  234.       AddTag(#SA_BitMap, BitMapID())
  235. If OpenScreen(1, 320, 25, 8, *TagList)
  236.   DisplayPalette(4,ScreenID())
  237. EndIf
  238.  
  239. UseBitMap(0)
  240. ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP)
  241.       AddTag(#SA_Quiet,1)
  242.       AddTag(#SA_BitMap, BitMapID())
  243.       AddTag(#SA_Top, 28)
  244.       AddTag(#SA_Parent, ScreenID())
  245.       AddTag(#SA_Draggable, 0)
  246. If OpenScreen(0,320,240,5, *TagList)
  247.  
  248.   DisplayPalette(0, ScreenID())
  249.  
  250.   AmigaSpriteScreen(ScreenID())  ; AmigaSprite will be displayed on this screen
  251.  
  252.   AllocateSoundChannels(15) ; All Channels are reserved for Waponez II
  253.  
  254.   PlayerSpeed = 2      ; The speed of our player !
  255.  
  256.   db = 1
  257.    b = 0
  258.  
  259.   ScrollY.w = 240+32+16
  260.  
  261.   AdditionnalBlock = 8
  262.   BackgroundLine   = 0
  263.  
  264.   *Level1 = ?Level1
  265.  
  266.   PlaySound(1,-1)
  267.  
  268.   Repeat
  269.     VWait()
  270.  
  271.     DisplayAmigaSprite(0, 0, 321, 241)    ; remove the mouse pointer ! (Sprite 0 on Channel 0 at position 321, 241)
  272.    
  273.     ShowBitMap(db, ScreenID(), 0, ScrollY) ; Here is the double buffering tips
  274.                                            ; 'db' is alternately 0 and 1 so the bitmaps 0 and 1
  275.                                            ; are displayed one after other. When a bitmap is
  276.                                            ; displayed we do the work on the other bitmap.
  277.  
  278.     StartSpriteServer()    ; Start the sprite server !
  279.  
  280.     Gosub CheckPause
  281.  
  282.     If BackgroundLine < 15*4
  283.       ScrollY-1
  284.  
  285.       If ScrollY<16
  286.         ScrollY = 240+31+16
  287.       EndIf
  288.     Else
  289.       If Boss = 0
  290.         AlienDelay = 100
  291.       EndIf
  292.  
  293.       Boss = 1
  294.     EndIf
  295.  
  296.     db = 1-db
  297.     
  298.     UseSpriteBuffer(db)
  299.     
  300.     ResetSpriteServer()
  301.     RestoreBackGround()
  302.     
  303.     If BackgroundLine < 15*4
  304.     
  305.     BlockY = ScrollY & $FFF0 - 16   ; Little tip to have 16 boundary aligned Y coords..
  306.     
  307.     BlockID1 = PeekB(*Level1)+30     ; Read which blocks should be displayed on the background..
  308.     BlockID2 = PeekB(*Level1+1)+30   ;
  309.     
  310.     AddBlockSprite(BlockID1, BlockX   , BlockY)
  311.     AddBlockSprite(BlockID2, BlockX+16, BlockY)
  312.     AddBlockSprite(BlockID1, BlockX   , BlockY+240+32)
  313.     AddBlockSprite(BlockID2, BlockX+16, BlockY+240+32)
  314.     
  315.     If AdditionnalBlock
  316.       BlockID3 = PeekB(*Level1+2)+30
  317.     
  318.       AddBlockSprite(BlockID3, BlockX+32, BlockY)
  319.       AddBlockSprite(BlockID3, BlockX+32, BlockY+240+32)
  320.     
  321.       AdditionnalBlock-1
  322.       If db = 1
  323.         BlockX+16
  324.         *Level1+1
  325.       EndIf
  326.     EndIf
  327.  
  328.     If db = 1
  329.       BlockX+32
  330.       *Level1+2
  331.     EndIf
  332.  
  333.     If BlockX >= 320
  334.       BlockX = 0
  335.       AdditionnalBlock = 8
  336.       BackgroundLine+1
  337.     Endif
  338.  
  339.     EndIf
  340.  
  341.     UseSpriteBuffer(db)  ; Restore original buffer...
  342.  
  343.     Gosub CheckCollisions
  344.  
  345.     Gosub MovePlayers
  346.     
  347.     Gosub DisplayBullets
  348.     
  349.     Gosub NewAlienWave
  350.     
  351.     Gosub DisplayAliens
  352.     
  353.     Gosub DisplayExplosions
  354.  
  355.     If BulletDelay > 0
  356.       BulletDelay-1
  357.     EndIf
  358.      
  359.     WaitSpriteServer()
  360.     StopSpriteServer()
  361.   Until Quit = 1 OR PressedRawKey() = 69
  362.  
  363.   Gosub EndGame
  364.  
  365. EndIf
  366.  
  367. End
  368.  
  369.                                            
  370. MovePlayers:
  371.  
  372.   Select JoypadMovement(1)
  373.     Case 1
  374.       PlayerY - PlayerSpeed
  375.       PlayerImage = 1
  376.  
  377.     Case 2
  378.       PlayerY - PlayerSpeed
  379.       PlayerX + PlayerSpeed
  380.       PlayerImage = 2
  381.  
  382.     Case 3
  383.       PlayerX + PlayerSpeed
  384.       PlayerImage = 2
  385.  
  386.     Case 4
  387.       PlayerX + PlayerSpeed
  388.       PlayerY + PlayerSpeed
  389.       PlayerImage = 2
  390.  
  391.     Case 5
  392.       PlayerY + PlayerSpeed
  393.       PlayerImage = 1
  394.    
  395.     Case 6
  396.       PlayerY + PlayerSpeed
  397.       PlayerX - PlayerSpeed
  398.       PlayerImage = 3
  399.  
  400.     Case 7
  401.       PlayerX - PlayerSpeed
  402.       PlayerImage = 3
  403.     
  404.     Case 8
  405.       PlayerX - PlayerSpeed
  406.       PlayerY - PlayerSpeed
  407.       PlayerImage = 3
  408.  
  409.     Default
  410.       PlayerImage = 1
  411.  
  412.   EndSelect
  413.  
  414.   If PlayerX < 0 : PlayerX = 0 : EndIf
  415.   If PlayerY < 0 : PlayerY = 0 : EndIf
  416.  
  417.   If PlayerX > 320-PlayerWidth  : PlayerX = 320-PlayerWidth : EndIf
  418.   If PlayerY > 240-PlayerHeight : PlayerY = 240-PlayerHeight : EndIf
  419.  
  420.  
  421.   If Dead = 1 
  422.     AddElement(Explosion())
  423.     Explosion()\x = PlayerX
  424.     Explosion()\y = PlayerY
  425.  
  426.     Dead = 0
  427.   Else
  428.     If DeadDelay>0 
  429.       DeadDelay-1
  430.       If db=1 And DeadDelay < 100
  431.         AddBufferedSprite(PlayerImage, PlayerX, PlayerY+ScrollY)
  432.       EndIf
  433.     Else
  434.       AddBufferedSprite(PlayerImage, PlayerX, PlayerY+ScrollY)
  435.     EndIf
  436.   EndIf
  437.  
  438.   PressedButtons.l = JoypadButtons(1)
  439.   
  440.   
  441.   If PressedButtons & #PB_JOYPAD_BUTTON1
  442.     If BulletDelay = 0 And DeadDelay < 100
  443.     AddElement(Bullet())
  444.     Bullet()\x     = PlayerX+5
  445.     Bullet()\y     = PlayerY-10
  446.     Bullet()\Width = SpriteWidth(4)
  447.     Bullet()\Height= SpriteHeight(4)
  448.     Bullet()\Image = 4
  449.     Bullet()\SpeedY = -7
  450.     BulletDelay = 10
  451.  
  452.     AddElement(Bullet())
  453.     Bullet()\x = PlayerX+26
  454.     Bullet()\y = PlayerY+6
  455.     Bullet()\Width = SpriteWidth(6)
  456.     Bullet()\Height= SpriteHeight(6)
  457.     Bullet()\Image = 6
  458.     Bullet()\SpeedX = 7  
  459.  
  460.     AddElement(Bullet())
  461.     Bullet()\x = PlayerX-11
  462.     Bullet()\y = PlayerY+6
  463.     Bullet()\Width = SpriteWidth(7)
  464.     Bullet()\Height= SpriteHeight(7)
  465.     Bullet()\Image = 7
  466.     Bullet()\SpeedX = -7
  467.  
  468.     AddElement(Bullet())
  469.     Bullet()\x = PlayerX+26
  470.     Bullet()\y = PlayerY-6
  471.     Bullet()\Width = SpriteWidth(8)
  472.     Bullet()\Height= SpriteHeight(8)
  473.     Bullet()\Image = 8
  474.     Bullet()\SpeedX = 7
  475.     Bullet()\SpeedY = -7
  476.  
  477.     AddElement(Bullet())
  478.     Bullet()\x = PlayerX-11
  479.     Bullet()\y = PlayerY-6
  480.     Bullet()\Width = SpriteWidth(9)
  481.     Bullet()\Height= SpriteHeight(9)
  482.     Bullet()\Image = 9
  483.     Bullet()\SpeedX = -7
  484.     Bullet()\SpeedY = -7
  485.  
  486.     AddElement(Bullet())
  487.     Bullet()\x = PlayerX+12
  488.     Bullet()\y = PlayerY+32
  489.     Bullet()\Width = SpriteWidth(55)
  490.     Bullet()\Height= SpriteHeight(55)
  491.     Bullet()\Image = 55
  492.     Bullet()\SpeedY = 7
  493.  
  494.     PlaySound(0,1)
  495.  
  496.     EndIf
  497.   EndIf
  498.  
  499.   P2.l = JoypadButtons(0)
  500.  
  501.   If P2 & #PB_JOYPAD_BUTTON2
  502.     Quit = 1
  503.   EndIf
  504.  
  505. Return
  506.  
  507.  
  508. NewAlienWave:
  509.  
  510.   If AlienDelay = 0
  511.  
  512.     AddElement(Aliens())
  513.  
  514.     If Boss = 1
  515.       Aliens()\x = 100
  516.       Aliens()\y = -16
  517.       Aliens()\Width  = SpriteWidth(50)
  518.       Aliens()\Height = SpriteHeight(50)
  519.       Aliens()\Speed  = 2
  520.       Aliens()\StartImage = 50
  521.       Aliens()\EndImage = 50
  522.       Aliens()\ImageDelay = 1
  523.       Aliens()\NextImageDelay = 1
  524.       Aliens()\ActualImage = 50
  525.       Aliens()\Armor = 20
  526.    
  527.       AlienDelay = 80
  528.  
  529.     Else
  530.  
  531.     Aliens()\x = 100
  532.     Aliens()\y = -16
  533.     Aliens()\Width  = SpriteWidth(10) 
  534.     Aliens()\Height = SpriteHeight(10)
  535.     Aliens()\Speed = 2
  536.     Aliens()\StartImage  = 10 
  537.     Aliens()\EndImage    = 15 
  538.     Aliens()\ImageDelay  =  4
  539.     Aliens()\NextImageDelay = Aliens()\ImageDelay
  540.     Aliens()\ActualImage = 10
  541.     Aliens()\Armor = 4
  542.  
  543.     AlienDelay = 22
  544.  
  545.     Endif
  546.   Else
  547.     AlienDelay - 1
  548.   EndIf
  549.  
  550. Return
  551.  
  552.  
  553. DisplayAliens:
  554.  
  555.   ResetList(Aliens())
  556.   While NextElement(Aliens())
  557.  
  558.     AddBufferedSprite(Aliens()\ActualImage, Aliens()\x, Aliens()\y+ScrollY)
  559.  
  560.     Aliens()\y + Aliens()\Speed
  561.  
  562.     If Aliens()\NextImageDelay = 0
  563.  
  564.       Aliens()\ActualImage+1
  565.  
  566.       If Aliens()\ActualImage > Aliens()\EndImage
  567.         Aliens()\ActualImage = Aliens()\StartImage
  568.       EndIf
  569.  
  570.       Aliens()\NextImageDelay = Aliens()\ImageDelay
  571.     Else
  572.       Aliens()\NextImageDelay-1
  573.     EndIf
  574.  
  575.     If Aliens()\Armor <= 0 Or Aliens()\y > 240+16
  576.       If Aliens()\Armor <= 0
  577.  
  578.         AddElement(Explosion())
  579.         Explosion()\x = Aliens()\x
  580.         Explosion()\y = Aliens()\y
  581.  
  582.         Score+20
  583.       EndIf
  584.  
  585.       KillElement(Aliens())
  586.     EndIf
  587.   Wend
  588. Return
  589.  
  590.  
  591. DisplayBullets:
  592.  
  593.   ResetList(Bullet())
  594.   While NextElement(Bullet())
  595.  
  596.     If Bullet()\y < 0
  597.       KillElement(Bullet())
  598.     Else
  599.       If Bullet()\x < 0
  600.         KillElement(Bullet())
  601.       Else
  602.  
  603.         If Bullet()\x > 320-Bullet()\Width
  604.           KillElement(Bullet())
  605.         Else
  606.           If Bullet()\y > 245
  607.             KillElement(Bullet())
  608.           Else
  609.             AddBufferedSprite(Bullet()\Image, Bullet()\x, Bullet()\y+ScrollY)
  610.  
  611.             Bullet()\y + Bullet()\SpeedY
  612.             Bullet()\x + Bullet()\SpeedX
  613.           Endif
  614.         EndIf
  615.       EndIf
  616.     EndIf
  617.  
  618.   Wend
  619.  
  620. Return
  621.  
  622. ;
  623. ; This routine is very CPU intensive when many bullets are flying
  624. ; all around the screen...
  625. ;
  626. CheckCollisions:
  627.  
  628.   ResetList(Aliens())
  629.   While NextElement(Aliens())
  630.     ResetList(Bullet())
  631.     While NextElement(Bullet())
  632.  
  633.       If Bullet()\y <= Aliens()\y+Aliens()\Height
  634.         If Bullet()\y+Bullet()\Height >= Aliens()\y
  635.           If Bullet()\x+Bullet()\Width => Aliens()\x
  636.             If Bullet()\x <= Aliens()\x+Aliens()\Width
  637.               Aliens()\Armor-1
  638.               KillElement(Bullet())
  639.             EndIf
  640.           EndIf
  641.         EndIf
  642.       EndIf
  643.     Wend
  644.  
  645.     If DeadDelay = 0
  646.     If PlayerX+PlayerWidth > Aliens()\x
  647.       If PlayerX < Aliens()\x+Aliens()\Width
  648.         If PlayerY+PlayerHeight > Aliens()\y
  649.           If PlayerY < Aliens()\y+Aliens()\Height
  650.             Dead = 1
  651.             DeadDelay = 180 
  652.  
  653.             AddElement(Explosion())
  654.             Explosion()\x = Aliens()\x
  655.             Explosion()\y = Aliens()\y
  656.  
  657.             KillElement(Aliens())
  658.           EndIf
  659.         EndIf
  660.       EndIf
  661.     EndIf
  662.     EndIf
  663.   Wend
  664.  
  665. Return
  666.  
  667.  
  668. DisplayExplosions:
  669.  
  670.   ResetList(Explosion())
  671.   While NextElement(Explosion())
  672.  
  673.     AddBufferedSprite(Explosion()\State+20, Explosion()\x, Explosion()\y+ScrollY)
  674.  
  675.     If Explosion()\Delay = 0
  676.       If Explosion()\State = 0
  677.         PlaySound(2,1) 
  678.       EndIf
  679.  
  680.       If Explosion()\State < 7
  681.         Explosion()\State+1
  682.         Explosion()\Delay = 2
  683.       Else
  684.         KillElement(Explosion())
  685.       Endif
  686.     Else
  687.       Explosion()\Delay-1
  688.     EndIf
  689.   Wend
  690.  
  691. Return
  692.  
  693.  
  694. CheckPause:
  695.  
  696.   If PressedRawKey() = 25
  697.  
  698.     WaitSpriteServer()
  699.     StopSpriteServer()
  700.  
  701.     StopSound(0)
  702.  
  703.     Repeat
  704.       VWait()
  705.     Until PressedRawKey() <> 25
  706.  
  707.     Repeat
  708.       VWait()
  709.     Until PressedRawKey() = 25
  710.  
  711.     Repeat
  712.       VWait()
  713.     Until PressedRawKey() <> 25
  714.  
  715.     PlaySound(1,-1)
  716.  
  717.     StartSpriteServer()
  718.  
  719.   EndIf
  720. Return
  721.  
  722.  
  723. EndGame:
  724.  
  725.   FadeOut(0, ScreenID(), 4, 64)
  726.  
  727.   HideScreen()
  728.  
  729. Return
  730.  
  731.  
  732. Level1:
  733. IncludeBinary "PureBasic:Examples/WaponezII/DefaultMap"
  734.